var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var o in t) t.hasOwnProperty(o) && (e[o] = t[o]);
    })(e, t);
}, function(e, t) {
    function n() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, 
    new n());
}), a = this && this.__decorate || function(e, t, o, n) {
    var i, a = arguments.length, r = a < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, o) : n;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(e, t, o, n); else for (var s = e.length - 1; 0 <= s; s--) (i = e[s]) && (r = (a < 3 ? i(r) : 3 < a ? i(t, o, r) : i(t, o)) || r);
    return 3 < a && r && Object.defineProperty(t, o, r), r;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("Global"), s = e("AudioManager"), c = e("GameConfig"), l = e("GameData"), d = e("EggsManager"), u = e("DataManager"), p = e("LoadManager"), h = e("UIManager"), f = e("WebManager"), g = cc._decorator, m = g.ccclass, y = g.property, v = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.pageView = null, e.itemNode = null, e.shadow = null, e.idx = 6, e;
    }
    return i(e, t), e.prototype.onLoad = function() {
        c.GC.isVaild("eggsWZZS") || -1 != d.default.getInstance().checkEggPerson(this.idx) ? this.node.destroy() : this.init();
    }, e.prototype.onClickUp = function() {
        var e = this.pageView.getCurrentPageIndex();
        this.pageView.scrollToPage(e - 1, .1);
    }, e.prototype.onClickDown = function() {
        var e = this.pageView.getCurrentPageIndex();
        this.pageView.scrollToPage(e + 1, .1);
    }, e.prototype.onClickScroll = function() {
        -1 == d.default.getInstance().checkEggPerson(this.idx) && (3 == this.pageView.getCurrentPageIndex() ? (f.default.getInstance().sentLog("触发皮肤彩蛋id:" + this.idx), 
        this.scheduleOnce(this.doTimer, .5)) : this.stopTimer());
    }, e.prototype.start = function() {}, e.prototype.init = function() {
        for (var e = 2020; e < 2031; e++) {
            var t = cc.instantiate(this.itemNode);
            t.getComponent(cc.Label).string = e.toString(), t.active = !0, this.pageView.addPage(t);
        }
    }, e.prototype.doTimer = function() {
        var t = this;
        f.default.getInstance().sentLog("获得皮肤彩蛋id:" + this.idx), s.default.getInstance().playAudio("皮肤出现"), 
        this.shadow.active = !0;
        var o = new cc.Node().addComponent(sp.Skeleton);
        p.default.getInstance().loadRes({
            url: "skeleton/皮肤" + r.G.eggPersonModelList[this.idx].m + "/skeleton",
            type: sp.SkeletonData
        }).then(function(e) {
            o.skeletonData = e, o.node.setPosition(cc.v2(0, -60)), o.node.parent = cc.Canvas.instance.node, 
            o.node.scale = 1, o.node.zIndex = 1, o.setAnimation(0, "animation", !1), s.default.getInstance().playAudio("彩蛋皮肤" + r.G.eggPersonModelList[t.idx].m, 2), 
            o.setCompleteListener(function() {
                t.shadow.active = !1, o.setCompleteListener(null), o.node.destroy(), h.default.getInstance().loadPopPnl("egg_reward", {
                    type: r.RewardType.SKIN,
                    idx: t.idx
                });
            });
        }), d.default.getInstance().updateEggPerson(this.idx), l.GD.personIdx = -1 - this.idx, 
        l.GD.eggsHintState = 1, u.default.getInstance().save();
    }, e.prototype.stopTimer = function() {
        this.unschedule(this.doTimer);
    }, a([ y(cc.PageView) ], e.prototype, "pageView", void 0), a([ y(cc.Node) ], e.prototype, "itemNode", void 0), 
    a([ y(cc.Node) ], e.prototype, "shadow", void 0), a([ m ], e);
}(cc.Component);

n.default = v;